$().ready(function() {
// 在键盘按下并释放及提交后验证提交表单
    $("#defaultForm").validate({
        errorPlacement: function(error, element) {
            if(element.parent().children().length == 3){
                error.appendTo(element.parent().parent().parent().parent());
            }else{
                error.appendTo(element.parent());
            }
        },
        rules: {
            title: {
                required: true,
            },
            file: {
                required: true
            },
            text: {
                required: true
            }

        },
        messages: {
            title: {
                required: "请输入标题"
            },
            file: {
                required: "请上传图片"
            },
            text: {
                required: "请输入简介"
            }

        }
    })
});